package com.example.demo.controller;

import com.example.demo.entity.Pick.PickDTO;
import com.example.demo.entity.Pick.PickVO;
import com.example.demo.services.PickService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/pick")
public class PickController {
    @Autowired
    private PickService service;

    @PostMapping("/getDetail")
    public List<PickDTO> getDetail(@RequestBody Map<String, String> payload) {
        String billNo = payload.get("billNo");
        return service.getPickProduceWpTakeGoods(billNo);
    }

    @PostMapping("/save")
    public int saveAll(@RequestBody PickVO payload) {
        return service.saveAll(payload);
    }

    @PostMapping("/getWorker")
    public String getWorker(@RequestBody Map<String, String> payload) {
        String code = payload.get("workerCode");
        return service.getWorker(code);
    }
}
